Ext.define('QMS.model.Unit', {
	extend: 'Ext.data.TreeModel',
	fields: ['id', 'organisation_id', 'name', 'description', 'text'],
	belongsTo: {
		name:'organisation',
		type: 'belongsTo',
		model: 'QMS.model.Organisation'
	},
	hasMany: {model: 'QMS.model.Project', name: 'projects'},
	proxy: {
		type: 'ajax',
		url: 'unit',
		reader: {
			type: 'json',
			root: 'root'
		},
		api: {
			create: 'unit?do_action=create',
			read: 'unit?do_action=read',
			update: 'unit?do_action=update',
			destroy: 'unit?do_action=destroy',
		},
	},
});
